package org.onion.pattern.event.consumer;

/**
 * 事件消费拦截器
 */
public interface EventConsumeInterceptor {

    default boolean preHandle(ExternalEventInfo eventInfo, Object metadata, EventConsumeHandler handler) {
        return true;
    }

    default void postHandle(ExternalEventInfo eventInfo, Object metadata, EventConsumeHandler handler) {

    }

    default void afterCompletion(ExternalEventInfo eventInfo, Object metadata, EventConsumeHandler handler, Exception ex) {
       
    }

    /**
     * 越小越先执行
     */
    default int order() {
        return 0;
    }

}
